package runthrad.callback;

import javax.xml.bind.DatatypeConverter;
import java.util.ArrayList;

/**
 * 回调 （实例方法回调）
 * @author DELL
 * @create 2017-09-20 17:30
 */
public class CallbackDigestUserInterface {
    public static void receiveDigest(byte[] digest, String name) {
        StringBuilder result = new StringBuilder(name);
        result.append(": ");
        result.append(DatatypeConverter.printHexBinary(digest));
        System.out.println(result);
    }

    public static void main(String[] args) {
        ArrayList<String> files = new ArrayList<>();
        files.add("src/file/file.txt");
        files.add("src/file/file2.txt");
        files.add("src/file/file3.txt");
        for (String file : files) {
            CallbackDigest cb = new CallbackDigest(file);
            Thread t = new Thread(cb);
            t.start();
        }
    }
}
